package cc.rengu.igas.share.facade.bean.cups;

import cc.rengu.oltp.service.common.enums.OltpRpcdEnum;
import cc.rengu.oltp.service.model.BizException;

import java.util.Arrays;

/**
 * F48 AS PZ  用户号码类型
 *
 * @author fangminwei
 * @date 2021/4/17
 */
@SuppressWarnings("AlibabaEnumConstantsMustHaveComment")
public enum F48_AS_PZ_UserCodeTypeEnum {
    _01("01", "移动电话（用作支付方式时，表示移动电话支付）"),
    _02("02", "固定电话（用作支付方式时，表示固定电话支付）"),
    _03("03", "水费"),
    _04("04", "电费"),
    _05("05", "煤气费"),
    _06("06", "社保"),
    _07("07", "小灵通"),
    _08("08", "信用卡还款"),
    _09("09", "烟草"),
    _10("10", "信用卡中心"),
    _11("11", "有线和付费电视"),
    _12("12", "保险"),
    _13("13", "税务"),
    _14("14", "证券公司"),
    _15("15", "金融机构"),
    _16("16", "贷款还款"),
    _17("17", "网络服务费"),
    _18("18", "资金归集"),
    _19("19", "教育费"),
    _20("20", "物业管理费"),
    _21("21", "公益捐款"),
    _CS("CS", "财税库银"),
    _RZ("RZ", "商户实时入账"),
    _OT("OT", "其他"),

    ;

    private String code;
    private String desc;

    F48_AS_PZ_UserCodeTypeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    @Override
    public String toString() {
        return code + "-" + desc;
    }

    public static F48_AS_PZ_UserCodeTypeEnum find(String code) {
        F48_AS_PZ_UserCodeTypeEnum result = Arrays.stream(F48_AS_PZ_UserCodeTypeEnum.values())
                .filter(e -> e.getCode().equals(code)).findFirst().orElse(null);

        if (result == null) {
            throw new BizException(OltpRpcdEnum.PARAM_IS_EMPTY_OR_NULL.getRespCode(), "找不到对应的枚举信息" + code);
        }
        return result;
    }
}
